<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
require_once '../model/work.php';
require_once '../model/keywork.php';
require_once '../model/db.php';

$work = new works();
$keyword = new keywords();


$hienthi = $keyword->select();
$hienthi2 = $work->kworkd();
?>
<h1>Bao Thien</h1>
<table border="1px">
    <tr class="a">
        <td>id</td>
        <td>name</td>

    </tr>
        <a href='index.php?if=1'> << First </a>
        <?php foreach ($hienthi as $item): ?>
        <tr>
            <td><?php echo $item["id"] . "<br>"; ?></td>
            <td><?php echo $item["name"] . "<br>"; ?></td>
        </tr>
    <?php endforeach; ?></table>
    <a href='index.php?if=95'>Last >></a>
<h1>Works</h1>
<table border="1px">
    <tr class="b">
        <td>id</td>
        <td>name</td>
        <td>posted</td>
        <td>location</td>
        <td>description</td>

    </tr>
    <?php foreach ($hienthi2 as $item): ?>
        <tr>
            <td><?php echo $item["id"] . "<br>"; ?></td>
            <td><?php echo substr($item["name"], 0, 50); ?></td>
            <td><?php echo $item["posted"] . "<br>"; ?></td>
            <td><?php echo $item["location"] . "<br>"; ?></td>
            <td><?php echo substr($item['description'], 0, 100); ?></td>
        </tr>
    <?php endforeach; ?></table>


<?php
$baitren_mottrang = 10;
// N?u chua ch?n trang d? xem. thì ta m?c d?nh ngu?i dùng xem dang s? 0 .
if (!isset($_GET['page'])) {
    $page = 0;
} else {
    $page = $_GET['page'];
}

$sodu_lieu = mysql_num_rows(mysql_query("SELECT * FROM works ")) or die(mysql_error());

$sotrang = $sodu_lieu / $baitren_mottrang;
$huuha = $page * $baitren_mottrang;
$result = mysql_query("SELECT * FROM works LIMIT {$huuha},{$baitren_mottrang} ") or die(mysql_error());

while ($info = mysql_fetch_array($result)) {

    $info['id'];

    $info['name'];

    echo $info['id'];
    echo $info['name'];
    echo "<br>";
}

for ($page = 0; $page <= $sotrang; $page++) {
    echo "<a href='index.php?page={$page}'> {$page} </a>";
}
?>
<?php ?>








































